﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Twodi.Aspect.Interfaces;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Twodi.Interfaces;

namespace Twodi.Implemented
{
    public class AbstractTexted : RenderManaged, ITextAspect
    {
        public AbstractTexted(Game game)
            : base(game)
        {

        }

        /// <summary>
        /// Renderizar texto.
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Render(GameTime gameTime)
        {
            if (ValidSpriteBatch)
            {
                SpriteBatch.DrawString(TextProperties.Font, Text, Position, Color, Rotation, Origin, Scale, SpriteEffects.None, 0);
            }
        }

        /// <summary>
        /// Cor do texto.
        /// </summary>
        public Color Color
        {
            get
            {
                return this.TextProperties.Color;
            }
            set
            {
                this.TextProperties.Color = value;
            }
        }

        /// <summary>
        /// Valor do texto.
        /// </summary>
        public String Text
        {
            get
            {
                return this.TextProperties.Text;
            }
            set
            {
                this.TextProperties.Text = value;
            }
        }

        /// <summary>
        /// Fonte do texto.
        /// </summary>
        public SpriteFont Font
        {
            get
            {
                return this.TextProperties.Font;
            }
        }

        public IText TextProperties
        {
            get;
            set;
        }
    }
}
